
function unbindBtn() {

    var btnArr = new Array();
    for (var i = 1; i <= 2; i++) {
        btnArr[i] = document.getElementById("btn" + i);
        (
	        	btnArr[i].onclick = function(){  //非闭包函数绑定事件
	        	    alert("百度经验" + i );
	        	}
        )
    }
    // alert(btnArr);
    console.log(btnArr, "obj");
    console.log(btnArr.constructor, "constructor"); //ƒ Array() { [native code] }
    console.log(btnArr.prototype, "prototype");
}

function bindBtn() {
    var btnArr = new Array();
    for (var i = 1; i <= 2; i++) {
        btnArr[i] = document.getElementById("btn" + i);
        (
        	function(obj,index){  //闭包函数绑定事件
	        	obj.onclick = function(){
	        	    alert("百度经验" + index );
	        	}
            }(btnArr[i],i)
        )
    }
    // alert(btnArr);
    console.log(btnArr, "obj");
    console.log(btnArr.constructor, "constructor"); //ƒ Array() { [native code] }
    console.log(btnArr.prototype, "prototype");
}

window.onload = function() {

	unbindBtn();
    // bindBtn();

}